@echo off
REM PPH Production: Restart all services with PM2 (Windows cmd)
REM Encoding: ASCII/UTF-8 without BOM preferred; pure English to avoid codepage issues.

setlocal enabledelayedexpansion

where pm2 >nul 2>nul
if errorlevel 1 (
  echo pm2 not found in PATH. Using npx pm2.
  set PM2=npx pm2
) else (
  set PM2=pm2
)

REM Restart each service (idempotent)
%PM2% restart pph-backend
%PM2% restart pph-frontend
%PM2% restart pph-management
%PM2% restart pph-memory-optimizer

REM Show status
%PM2% list

echo Done. Open http://localhost:3012
exit /b 0

